/*
 * @Author: wangyifei 844650674@qq.com
 * @Date: 2022-11-27 10:22:27
 * @LastEditors: wangyifei 844650674@qq.com
 * @LastEditTime: 2022-11-27 13:12:35
 * @FilePath: \management_system_template\admin-server\router\user.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
const express = require("express");
const router = express.Router();
const userCtrl = require("../controller/user");
const userValidator = require("../validator/user");

// 用户登录
router.post("/users/login", userValidator.login, userCtrl.login),
// 用户注册
router.post("/users", userValidator.register, userCtrl.register);
// 获取用户列表
router.get("/users", userCtrl.getAllUsers);
// 获取当前用户
router.get("/user/:id", userCtrl.getUser);
// 编辑当前用户
router.post("/user/:id", userCtrl.updateUser);
// 更新用户
router.post("/user/data/:id", userCtrl.updateUserData);
// 是否有超管账号
router.post("/users/hasAdmin", userCtrl.hasAdmin);
// 删除用户
router.delete("/user/:id", userCtrl.deleteUser);

router.post("/model", userCtrl.addModel);
router.post("/model/:id", userCtrl.updateModelData);
router.get("/model", userCtrl.getModel);
router.delete("/model/:id", userCtrl.deleteModel);

module.exports = router;
